package com.ilaempire.bedb.client;

import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.util.Padding;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.HBoxLayout;
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
import com.extjs.gxt.ui.client.widget.layout.HBoxLayout.HBoxLayoutAlign;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

public class Bb_s_EVE_Database implements EntryPoint {
	private Viewport body = new Viewport();
	public LayoutContainer barFuntion = new LayoutContainer();
	private Label logo = new Label("bb's EVE Database");
	public static Label labelSysError = new Label();
	LayoutContainer mainBorder = new LayoutContainer();
	public BorderLayoutData mainBorderNorthData = new BorderLayoutData(LayoutRegion.NORTH,30);
	public BorderLayoutData mainBorderCenterData = new BorderLayoutData(LayoutRegion.CENTER);
	
	public TabCharacter tabCharacter = new TabCharacter();
	public TabItem tabManufacture = new TabItem("Manufacture");
	public TabItem tabReprocessing = new TabItem("Reprocessing");
	public TabItem tabAgent = new TabItem("Agent");
	public TabItem tabStation = new TabItem("Station");
	public TabItem tabAbout = new TabItem("About");
	
	private TabPanel mainTab = new TabPanel();
	
	//JSONP
	public static int jsonRequestID = 0;

	public void onModuleLoad() {
		//Single Page 
		body.setLayout(new FitLayout());
		body.add(mainBorder);
		
		//Main Border
		mainBorder.setLayout(new BorderLayout());
		mainBorder.add(barFuntion,mainBorderNorthData);
		mainBorder.add(mainTab,mainBorderCenterData);
		
		//Title & Error Message
		//barFuntion.setHeaderVisible(false);
		//barFuntion.setFrame(false);
		HBoxLayout barFuntionLayout = new HBoxLayout();
		barFuntionLayout.setPadding(new Padding(5));
		barFuntionLayout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);
		
		barFuntion.setLayout(barFuntionLayout);
		
		HBoxLayoutData logoData = new HBoxLayoutData(new Margins(0,5,0,0));
		//logoData.setFlex(1);
		barFuntion.add(logo,logoData);
		barFuntion.add(labelSysError,new HBoxLayoutData(new Margins(0,5,0,0)));
		
		//Main Window With Tabs
		mainTab.setBodyBorder(false);
		
		//Character
		tabCharacter.load();
		
		mainTab.add(tabCharacter);
		mainTab.add(tabManufacture);
		mainTab.add(tabReprocessing);
		mainTab.add(tabAgent);
		mainTab.add(tabStation);
		mainTab.add(tabAbout);
		
		RootPanel.get().add(body);
		
	}
	
	

}
